package com.qeeyou.apps.android.craftsman.view;

import android.app.Dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.qeeyou.apps.android.craftsman.R;


/**
 * Created by xuchengxiong on 2016/10/13.
 */

public class CustomConfirmDialog extends Dialog {
    private TextView messageTextView;
    private Button okButton;

    public CustomConfirmDialog(Context context) {
        super(context, R.style.CustomDialog);
        setCustomDialog();
    }

    private void setCustomDialog() {
        View view = LayoutInflater.from(getContext()).inflate(R.layout.view_custom_confirm_alert, null);
        messageTextView = (TextView) view.findViewById(R.id.txtvMessage4ConfirmAlert);
        okButton = (Button) view.findViewById(R.id.btnOK4ConfirmAlert);
        super.setContentView(view);
    }

    @Override
    public void setContentView(int layoutResID) {
        super.setContentView(layoutResID);
    }

    @Override
    public void setContentView(View view) {
        super.setContentView(view);
    }

    @Override
    public void setContentView(View view, ViewGroup.LayoutParams params) {
        super.setContentView(view, params);
    }

    public void setMessage(CharSequence message) {
        messageTextView.setText(message);
    }

    public void setMessage(int messageId) {
        messageTextView.setText(messageId);
    }

    public void setOnOKListener(String buttonTitle, View.OnClickListener listener) {
        okButton.setText(buttonTitle);
        okButton.setOnClickListener(listener);
    }

    public void setOnCancelListener(OnCancelListener listener) {
        super.setOnCancelListener(listener);
    }
}
